<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="24">
        <SearchForm
          v-show="showSearch"
          v-model="queryParams"
          :options="options.formOps"
          @onQuery="getList"
        >
        </SearchForm>
        <el-row :gutter="10" class="mb8">
          <right-toolbar
            v-model:showSearch="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row>
        <Table
          ref="table"
          :auto-featch="true"
          :fetch-data="fetchData"
          :options="options.table"
          :actionWidth="300"
          :useAction="false"
        >
          <!-- <template #default>
            <el-table-column label="隐患数量" align="center">
              <template #default="{ row }">
                <el-button type="text"></el-button
              ></template>
            </el-table-column>
          </template> -->
        </Table>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import Table from "@/components/Table/index.vue";
import SearchForm from "@/components/searchForm/index";
import formJson from "./components/options.json";
import { apis as APIS } from "@/api/yhpc/jhprcrw.js";
import { useAsyncData, useFormJsonNew } from "@/views/hooks/useAsyncData.js";
const { proxy } = getCurrentInstance();
const ops = useFormJsonNew(formJson, {
  sort: [],
  sortable: [],
});

const options = reactive({
  table: ops,
  formOps: ops.filter((i) =>
    [
      "planUserNames",
      "checkUserName",
      "checkLevel",
      "analysisUnit",
      "nickName",
      "deviceName",
      "analysisUnit",
    ].includes(i.prop)
  ),
});
const showSearch = ref(true);
const dialogVform = ref();
const table = ref();

const { fetchData, getList, queryParams, form } = useAsyncData({
  APIS: {
    query: APIS.getTaskInfoByUserName,
  },
  formJson,
  dialogVform,
  table,
  proxy,
});

onMounted(() => {});
</script>

<style lang="scss" scoped>
::v-deep.el-form-item__label {
  text-align: right !important;
}
</style>
